/*
 * AI.java
 */

package project2;

/**
 * Super class of an Othello playing AI class. The purpose of this class
 * is to provide a standard way to utilize each (CPSC-315) team's Othello
 * AI system.
 */
public abstract class AI
{
    /**
     * The index of the row index in a length 2 integer array specifying
     * a move.
     */
    public static final int ROW_INDEX = 0;
    /**
     * The index of the column index in a length 2 integer array specifying
     * a move.
     */
    public static final int COL_INDEX = 1;

    /**
     * Possible difficulty settings (EASY, MEDIUM, or HARD).
     */
    public enum Difficulty {EASY, MEDIUM, HARD};

    /**
     * Possible player colors (BLACK, WHITE, or EMPTY).
     */
    public enum Player {BLACK, WHITE, EMPTY};

    /** The player color. */
    private Player player;

    /** The AI's difficulty level. */
    private Difficulty difficulty;

    /**
     * Constructs an AI object with a specified difficulty level.
     * @param difficulty a difficulty level (EASY, MEDIUM, or HARD)
     * @throws IllegalArgumentException if the <code>player</code> argument is <code>Player.EMPTY</code>
     */
    public AI(Player player, Difficulty difficulty) throws IllegalArgumentException
    {
		if(player == Player.EMPTY){
			throw new IllegalArgumentException("Constructing an AI player for Othello requires either a BLACK or WHITE player.");
	}
	this.player = player;
	this.difficulty = difficulty;
    }

    /**
     * Returns the difficulty level of this AI player.
     */
    public final Difficulty getDifficulty()
    {
	return difficulty;
    }

    /**
     * Returns the player color (BLACK or WHITE).
     */
    public final Player getPlayer()
    {
	return player;
    }

    /**
     * Returns the desired move in the length 2 integer array making the
     * decision based on the <code>boardState</code>, an 8x8 array of
     * <code>Player</code> objects (BLACK, WHITE, or EMPTY), the
     * <code>lastMove</code>, a length 2 integer array, and any other
     * stored information. The desired move is specified by two indices the
     * first index (e.g. <code>lastMove[ROW_INDEX]</code>) refers to a row of
     * the game board and the second index
     * (e.g. <code>lastMove[COL_INDEX]</code>) refers to a column of the game
     * board.<p></p>
     *
     * Any invalid moves should be interpreted as a pass. Changes to the
     * <code>boardState</code> parameter are permitted.
     *
     * @param boardState a two dimensional 8x8 array representing the state of
     * an Othello game board
     * @param lastMove the move made by the last player
     * @return a desired move, which is a length 2 integer array specifying a
     * row and column to place a piece
     */
    public abstract int[] makeMove(Player[][] boardState, int[] lastMove);
}